package ru.tatintec.gwttest.client.view;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class EmployeeListComposite extends Composite {

	private Button addButton = new Button("Add employee");
	private Button generateButton = new Button("Generate test data");
	private Label noDataLabel = new Label("Employee catalog is empty");

	private FlexTable table = new FlexTable();
	
	public class DeleteEditPanel extends HorizontalPanel {
		private Button deleteButton = new Button("Delete");
		private Button editButton = new Button("Edit");
		public DeleteEditPanel() {
			super();
			this.add(editButton);
			this.add(deleteButton);
		}
		public Button getDeleteButton() {
			return deleteButton;
		}
		public Button getEditButton() {
			return editButton;
		}
	}
	

	public EmployeeListComposite() {
		VerticalPanel vp = new VerticalPanel();
		HorizontalPanel hp = new HorizontalPanel();
		hp.add(addButton);
		hp.add(generateButton);
		vp.add(hp);
		noDataLabel.setVisible(false);
		vp.add(noDataLabel);
		vp.add(table);
		initWidget(vp);
		
		table.setBorderWidth(1);
		table.setVisible(false);
		table.setWidth("100%");
		setWidth("1200px");
		
	}
	

	public Button getAddButton() {
		return addButton;
	}

	public FlexTable getTable() {
		return table;
	}


	public Button getGenerateButton() {
		return generateButton;
	}


	public Label getNoDataLabel() {
		return noDataLabel;
	}

	
	public void addTableHeader() {
		table.setWidget(0, 1, new Label("Last First Middle name"));
		table.setWidget(0, 2, new Label("Sex"));
		table.setWidget(0, 3, new Label("Birthday"));
		table.setWidget(0, 4, new Label("Employment day"));
		table.setWidget(0, 5, new Label("Action"));
	}


	
}


